using Common;
using Common.DEncrypt;
using DukeyTbker;
using DukeyTbker.API;
using DukeyTbker.Properties;
using ns0;
using ns1;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Runtime.CompilerServices;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Windows.Forms;

public class MainFrm : Form {
    private bool bool_0;
    private Button btnAutoShare;
    private Button btnBrowser;
    private Button btnClear;
    private Button btnCollect;
    private Button btnImport;
    private Button btnOutput;
    private Button button1;
    private Button button4;
    private ColumnHeader columnHeader_0;
    private ColumnHeader columnHeader_1;
    private ColumnHeader columnHeader_2;
    private ColumnHeader columnHeader_3;
    private ColumnHeader columnHeader_4;
    private ColumnHeader columnHeader_5;
    private ColumnHeader columnHeader_6;
    private ColumnHeader columnHeader_7;
    private ContextMenuStrip contextMenuStrip1;
    private dukeyauth dukeyauth_0;
    private GroupBox groupBox1;
    private IContainer icontainer_0;
    private Label label1;
    private Label label2;
    private Label label3;
    private Label label4;
    private Label label5;
    private Label lblTip;
    private LoginFetchFrm loginFetchFrm_0;
    private ListView lvList;
    private OpenFileDialog openFileDialog_0;
    [CompilerGenerated]
    private static Predicate<tbproduct> predicate_0;
    private SaveFileDialog saveFileDialog_0;
    private string string_0 = "error";
    private string string_1 = "";
    private PictureBox tbimg;
    private Thread thread_0;
    private Thread thread_1;
    private ToolTip toolTip_0;
    private TextBox txtclick;
    private TextBox txtImageUrl;
    private TextBox txtPrice;
    private TextBox txtSummary;
    private TextBox txtTitle;
    private WebBrowser webBrowser1;
    private ToolStripMenuItem 查看宝贝ToolStripMenuItem;
    private ToolStripMenuItem 清空列表ToolStripMenuItem;
    private ToolStripMenuItem 删除所选ToolStripMenuItem;

    public MainFrm() {
        this.InitializeComponent();
        Control.CheckForIllegalCrossThreadCalls = false;
        MiddleModule.eventSend += new Send(this.method_0);
        this.dukeyauth_0 = new dukeyauth();
        //this.thread_1 = new Thread(new ThreadStart(this.CheckIsRegister));
        //this.thread_1.Start();
    }

    private void btnAutoShare_Click(object sender, EventArgs e) {
        MessageBox.Show("该功能将在下个版本开放!");
    }

    private void btnBrowser_Click(object sender, EventArgs e) {
        if (this.loginFetchFrm_0 == null) {
            this.loginFetchFrm_0 = new LoginFetchFrm();
        }
        if (this.loginFetchFrm_0.IsDisposed) {
            this.loginFetchFrm_0 = null;
            this.loginFetchFrm_0 = new LoginFetchFrm();
        }
        this.loginFetchFrm_0.Visible = !this.loginFetchFrm_0.Visible;
    }

    private void btnClear_Click(object sender, EventArgs e) {
        this.txtTitle.Text = string.Empty;
        this.txtImageUrl.Text = string.Empty;
        this.txtSummary.Text = string.Empty;
        this.txtclick.Text = string.Empty;
    }

    private void btnCollect_Click(object sender, EventArgs e) {
        if (Comm.ContainerCookies == string.Empty) {
            MessageBox.Show("请先登录阿里妈妈!");
        }
        else {
            if (this.thread_0 == null) {
                this.thread_0 = new Thread(new ThreadStart(this.method_2));
            }
            if (this.thread_0.ThreadState == System.Threading.ThreadState.Unstarted) {
                this.thread_0.Start();
                this.btnCollect.Enabled = false;
            }
            if (this.thread_0.ThreadState == System.Threading.ThreadState.Suspended) {
                this.thread_0.Resume();
                this.btnCollect.Enabled = false;
            }
        }
    }

    private void btnImport_Click(object sender, EventArgs e) {
        try {
            if (this.openFileDialog_0.ShowDialog() == DialogResult.OK) {
                List<string[]> list = CSVHelper.ReadCSV(this.openFileDialog_0.FileName);
                int num2 = 0;
                foreach (string[] strArray in list) {
                    ListViewItem item = new ListViewItem();
                    item.SubItems[0].Text = (this.lvList.Items.Count + 1).ToString();
                    item.SubItems.AddRange(new string[] { strArray[1], strArray[2], strArray[3], strArray[4], strArray[5], strArray[6], strArray[7] });
                    item.Tag = strArray[0];
                    if (!string.IsNullOrEmpty(strArray[1]) && (num2 > 0)) {
                        this.lvList.Items.Add(item);
                    }
                    num2++;
                }
                this.lblTip.Text = "导入数据成功!" + DateTime.Now.ToString("mm:ss");
            }
        }
        catch (Exception exception) {
            MessageBox.Show(exception.Message);
        }
    }

    private void btnOutput_Click(object sender, EventArgs e) {
        try {
            if (this.saveFileDialog_0.ShowDialog() == DialogResult.OK) {
                string[] strArray2 = new string[] { "编号", "标题", "原价", "打折价", "销量", "推广链接", "店铺名称", "图片" };
                string fileName = this.saveFileDialog_0.FileName;
                List<string[]> list = new List<string[]>();
                list.Add(strArray2);
                foreach (ListViewItem item in this.lvList.Items) {
                    string[] strArray4 = new string[] { "\"" + item.Tag.ToString() + "\"", "\"" + item.SubItems[1].Text + "\"", item.SubItems[2].Text, item.SubItems[3].Text, item.SubItems[4].Text, "\"" + item.SubItems[5].Text + "\"", "\"" + item.SubItems[6].Text + "\"", "\"" + item.SubItems[7].Text + "\"" };
                    list.Add(strArray4);
                }
                CSVHelper.WriteCSV(fileName, list);
                this.lblTip.Text = "导出数据成功!" + DateTime.Now.ToString("mm:ss");
            }
        }
        catch (Exception exception) {
            MessageBox.Show(exception.Message);
        }
    }

    private void button1_Click(object sender, EventArgs e) {
        new LoginFetchFrm().ShowDialog();
    }

    private void button1_Click_1(object sender, EventArgs e) {
        List<tbproductasmx> list = new List<tbproductasmx>();
        foreach (ListViewItem item in this.lvList.Items) {
            tbproductasmx tbproductasmx = new tbproductasmx();
            tbproductasmx.String_0 = item.Tag.ToString();
            tbproductasmx.title = item.SubItems[1].Text;
            tbproductasmx.price = item.SubItems[2].Text;
            tbproductasmx.link = string.Empty;
            tbproductasmx.mprice = item.SubItems[3].Text;
            tbproductasmx.picurl = item.SubItems[7].Text;
            list.Add(tbproductasmx);
        }
        if (list.Count > 0) {
            WebPublishOptionFrm frm = new WebPublishOptionFrm(list.ToArray());
            if (frm.ShowDialog() == DialogResult.OK) {
                MessageBox.Show("发布成功!");
            }
        }
        else {
            MessageBox.Show("请先采集数据喔^_^!");
        }
    }

    private void button4_Click(object sender, EventArgs e) {
        if ((this.txtTitle.Text.Trim() != string.Empty) && (this.txtImageUrl.Text.Trim() != string.Empty)) {
            string str = smethod_0(this.txtTitle.Text.Trim());
            string str2 = this.txtImageUrl.Text.Trim();
            string str3 = smethod_0(this.txtclick.Text.Trim());
            string str4 = smethod_0(this.txtSummary.Text.Trim());
            if (str3 != "") {
                Process.Start(string.Format("http://www.bshare.cn/bsyncShare?site=bsharesync&title={0}&pic={1}&summary={2}&url={3}", new object[] { str, str2, str4, str3 }));
            }
        }
        else {
            MessageBox.Show("请先进行推广内容设定!");
        }
    }

    private void CheckIsRegister() {
        try {
            Process.Start(AppDomain.CurrentDomain.BaseDirectory + @"\Updater.exe");
        }
        catch {
        }
        string regkey = Settings.Default.regkey;
        this.string_1 = WMICardGrab.smethod_3();
        if ((regkey != "") && (Common.DEncrypt.DEncrypt.Decrypt(regkey) != this.string_1)) {
            this.Text = this.Text.Replace("[未注册]", "") + "[已注册]";
            try {
                string email = Settings.Default.email.Replace(".", "-");
                switch (this.dukeyauth_0.AuthUserTbkSoft(email, this.string_1, regkey, "f897ed3a-fb14-4ad1-80a2-b69973743230", ref this.string_0, 0x109)) {
                    case "expire111":
                        base.Hide();
                        if (DialogResult.Yes == MessageBox.Show("你的产品已超过使用期,现在去续费吗", "温馨提示", MessageBoxButtons.YesNo)) {
                            Process.Start("explorer.exe", "http://www.dukeycms.com/xufee_" + email + "^" + this.string_1 + ".html");
                        }
                        Environment.Exit(0);
                        goto Label_0276;

                    case "nouser111": {
                            base.Hide();
                            Register register = new Register(this.string_1);
                            if (register.ShowDialog() == DialogResult.OK) {
                                this.bool_0 = true;
                                Environment.Exit(0);
                            }
                            else {
                                Environment.Exit(0);
                            }
                            goto Label_0276;
                        }
                }
                this.lblTip.Text = "云连接成功,正版授权给[" + Settings.Default.email + "]";
                this.webBrowser1.Url = new Uri("http://www.dukeycms.com/soft/tbksoftinfo.htm?id=" + Settings.Default.email + "#113");
                this.string_0 = "ok";
                goto Label_0276;
            }
            catch (Exception exception) {
                MessageBox.Show(exception.Message, "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                Environment.Exit(0);
                goto Label_0276;
            }
        }
        base.Hide();
        Register register2 = new Register(this.string_1);
        if (register2.ShowDialog() == DialogResult.OK) {
            this.Text = this.Text.Replace("[未注册]", "") + "[已注册]";
            this.bool_0 = true;
            this.string_0 = "ok";
            base.Show();
        }
        else {
            this.Text = this.Text + "[未注册]";
            Environment.Exit(0);
        }
    Label_0276:
        this.thread_1 = null;
    }

    protected override void Dispose(bool disposing) {
        if (disposing && (this.icontainer_0 != null)) {
            this.icontainer_0.Dispose();
        }
        base.Dispose(disposing);
    }

    private void InitializeComponent() {
        this.icontainer_0 = new Container();
        //ComponentResourceManager manager = new ComponentResourceManager(typeof(MainFrm));
        this.btnBrowser = new Button();
        this.button1 = new Button();
        this.btnOutput = new Button();
        this.btnImport = new Button();
        this.btnCollect = new Button();
        this.columnHeader_0 = new ColumnHeader();
        this.columnHeader_1 = new ColumnHeader();
        this.columnHeader_2 = new ColumnHeader();
        this.columnHeader_3 = new ColumnHeader();
        this.columnHeader_4 = new ColumnHeader();
        this.columnHeader_5 = new ColumnHeader();
        this.lvList = new ListView();
        this.columnHeader_6 = new ColumnHeader();
        this.columnHeader_7 = new ColumnHeader();
        this.contextMenuStrip1 = new ContextMenuStrip(this.icontainer_0);
        this.查看宝贝ToolStripMenuItem = new ToolStripMenuItem();
        this.删除所选ToolStripMenuItem = new ToolStripMenuItem();
        this.清空列表ToolStripMenuItem = new ToolStripMenuItem();
        this.tbimg = new PictureBox();
        this.button4 = new Button();
        this.groupBox1 = new GroupBox();
        this.txtSummary = new TextBox();
        this.label2 = new Label();
        this.txtPrice = new TextBox();
        this.txtTitle = new TextBox();
        this.label4 = new Label();
        this.label3 = new Label();
        this.label1 = new Label();
        this.txtclick = new TextBox();
        this.lblTip = new Label();
        this.saveFileDialog_0 = new SaveFileDialog();
        this.openFileDialog_0 = new OpenFileDialog();
        this.webBrowser1 = new WebBrowser();
        this.txtImageUrl = new TextBox();
        this.btnAutoShare = new Button();
        this.toolTip_0 = new ToolTip(this.icontainer_0);
        this.label5 = new Label();
        this.btnClear = new Button();
        this.contextMenuStrip1.SuspendLayout();
        ((ISupportInitialize)this.tbimg).BeginInit();
        this.groupBox1.SuspendLayout();
        base.SuspendLayout();
        this.btnBrowser.AutoSize = true;
        this.btnBrowser.Location = new Point(12, 13);
        this.btnBrowser.Name = "btnBrowser";
        this.btnBrowser.Size = new Size(0x75, 0x17);
        this.btnBrowser.TabIndex = 1;
        this.btnBrowser.Text = "打开/隐藏阿里妈妈";
        this.btnBrowser.UseVisualStyleBackColor = true;
        this.btnBrowser.Click += new EventHandler(this.btnBrowser_Click);
        this.button1.Location = new Point(0x300, 13);
        this.button1.Name = "button1";
        this.button1.Size = new Size(0x4b, 0x17);
        this.button1.TabIndex = 2;
        this.button1.Text = "发布到网站";
        this.button1.UseVisualStyleBackColor = true;
        this.button1.Click += new EventHandler(this.button1_Click_1);
        this.btnOutput.Location = new Point(0x299, 13);
        this.btnOutput.Name = "btnOutput";
        this.btnOutput.Size = new Size(0x4b, 0x17);
        this.btnOutput.TabIndex = 3;
        this.btnOutput.Text = "导出数据";
        this.btnOutput.UseVisualStyleBackColor = true;
        this.btnOutput.Click += new EventHandler(this.btnOutput_Click);
        this.btnImport.Location = new Point(0x248, 13);
        this.btnImport.Name = "btnImport";
        this.btnImport.Size = new Size(0x4b, 0x17);
        this.btnImport.TabIndex = 3;
        this.btnImport.Text = "导入数据";
        this.btnImport.UseVisualStyleBackColor = true;
        this.btnImport.Click += new EventHandler(this.btnImport_Click);
        this.btnCollect.AutoSize = true;
        this.btnCollect.Location = new Point(0x341, 0x22c);
        this.btnCollect.Name = "btnCollect";
        this.btnCollect.Size = new Size(0x57, 0x17);
        this.btnCollect.TabIndex = 5;
        this.btnCollect.Text = "采集推广链接";
        this.btnCollect.UseVisualStyleBackColor = true;
        this.btnCollect.Visible = false;
        this.btnCollect.Click += new EventHandler(this.btnCollect_Click);
        this.columnHeader_0.Text = "序号";
        this.columnHeader_1.Text = "标题";
        this.columnHeader_1.Width = 0xfb;
        this.columnHeader_2.Text = "原价";
        this.columnHeader_3.Text = "打折价";
        this.columnHeader_4.Text = "推广链接";
        this.columnHeader_4.Width = 0x117;
        this.columnHeader_5.Text = "销量";
        this.columnHeader_5.Width = 0x4a;
        this.lvList.AllowColumnReorder = true;
        this.lvList.Columns.AddRange(new ColumnHeader[] { this.columnHeader_0, this.columnHeader_1, this.columnHeader_2, this.columnHeader_3, this.columnHeader_5, this.columnHeader_4, this.columnHeader_6, this.columnHeader_7 });
        this.lvList.ContextMenuStrip = this.contextMenuStrip1;
        this.lvList.FullRowSelect = true;
        this.lvList.GridLines = true;
        this.lvList.Location = new Point(12, 0x95);
        this.lvList.Name = "lvList";
        this.lvList.Size = new Size(960, 0x191);
        this.lvList.TabIndex = 0;
        this.lvList.UseCompatibleStateImageBehavior = false;
        this.lvList.View = View.Details;
        this.lvList.MouseDoubleClick += new MouseEventHandler(this.lvList_MouseDoubleClick);
        this.lvList.ItemSelectionChanged += new ListViewItemSelectionChangedEventHandler(this.lvList_ItemSelectionChanged);
        this.columnHeader_6.Text = "店铺名称";
        this.columnHeader_6.Width = 0x6a;
        this.columnHeader_7.Text = "图片";
        this.columnHeader_7.Width = 0x67;
        this.contextMenuStrip1.Items.AddRange(new ToolStripItem[] { this.查看宝贝ToolStripMenuItem, this.删除所选ToolStripMenuItem, this.清空列表ToolStripMenuItem });
        this.contextMenuStrip1.Name = "contextMenuStrip1";
        this.contextMenuStrip1.Size = new Size(0x7d, 70);
        this.查看宝贝ToolStripMenuItem.Name = "查看宝贝ToolStripMenuItem";
        this.查看宝贝ToolStripMenuItem.Size = new Size(0x7c, 0x16);
        this.查看宝贝ToolStripMenuItem.Text = "查看宝贝";
        this.查看宝贝ToolStripMenuItem.Click += new EventHandler(this.查看宝贝ToolStripMenuItem_Click);
        this.删除所选ToolStripMenuItem.Name = "删除所选ToolStripMenuItem";
        this.删除所选ToolStripMenuItem.Size = new Size(0x7c, 0x16);
        this.删除所选ToolStripMenuItem.Text = "删除所选";
        this.删除所选ToolStripMenuItem.Click += new EventHandler(this.删除所选ToolStripMenuItem_Click);
        this.清空列表ToolStripMenuItem.Name = "清空列表ToolStripMenuItem";
        this.清空列表ToolStripMenuItem.Size = new Size(0x7c, 0x16);
        this.清空列表ToolStripMenuItem.Text = "清空列表";
        this.清空列表ToolStripMenuItem.Click += new EventHandler(this.清空列表ToolStripMenuItem_Click);
        this.tbimg.BackColor = Color.Transparent;
        this.tbimg.Location = new Point(12, 0x3b);
        this.tbimg.Name = "tbimg";
        this.tbimg.Size = new Size(80, 80);
        this.tbimg.SizeMode = PictureBoxSizeMode.AutoSize;
        this.tbimg.TabIndex = 6;
        this.tbimg.TabStop = false;
        this.button4.AutoSize = true;
        this.button4.Location = new Point(0x270, 0x47);
        this.button4.Name = "button4";
        this.button4.Size = new Size(0x6f, 0x17);
        this.button4.TabIndex = 8;
        this.button4.Text = "分享给朋友赚佣金";
        this.button4.UseVisualStyleBackColor = true;
        this.button4.Click += new EventHandler(this.button4_Click);
        this.groupBox1.Controls.Add(this.btnClear);
        this.groupBox1.Controls.Add(this.label5);
        this.groupBox1.Controls.Add(this.txtSummary);
        this.groupBox1.Controls.Add(this.label2);
        this.groupBox1.Controls.Add(this.txtImageUrl);
        this.groupBox1.Controls.Add(this.txtPrice);
        this.groupBox1.Controls.Add(this.txtTitle);
        this.groupBox1.Controls.Add(this.label4);
        this.groupBox1.Controls.Add(this.label3);
        this.groupBox1.Controls.Add(this.label1);
        this.groupBox1.Controls.Add(this.txtclick);
        this.groupBox1.Controls.Add(this.button4);
        this.groupBox1.Location = new Point(0x6c, 0x2a);
        this.groupBox1.Name = "groupBox1";
        this.groupBox1.Size = new Size(0x360, 100);
        this.groupBox1.TabIndex = 9;
        this.groupBox1.TabStop = false;
        this.groupBox1.Text = "宝贝信息";
        this.txtSummary.Location = new Point(0x39, 0x2f);
        this.txtSummary.Multiline = true;
        this.txtSummary.Name = "txtSummary";
        this.txtSummary.Size = new Size(0x12f, 0x18);
        this.txtSummary.TabIndex = 13;
        this.label2.AutoSize = true;
        this.label2.Location = new Point(0x287, 0x1d);
        this.label2.Name = "label2";
        this.label2.Size = new Size(0x23, 12);
        this.label2.TabIndex = 11;
        this.label2.Text = "价格:";
        this.txtPrice.Location = new Point(0x2b0, 0x13);
        this.txtPrice.Name = "txtPrice";
        this.txtPrice.Size = new Size(0x71, 0x15);
        this.txtPrice.TabIndex = 10;
        this.txtTitle.Location = new Point(0x39, 0x13);
        this.txtTitle.Name = "txtTitle";
        this.txtTitle.Size = new Size(0x23f, 0x15);
        this.txtTitle.TabIndex = 10;
        this.label4.AutoSize = true;
        this.label4.Location = new Point(0x16, 80);
        this.label4.Name = "label4";
        this.label4.Size = new Size(0x1d, 12);
        this.label4.TabIndex = 9;
        this.label4.Text = "URL:";
        this.label3.AutoSize = true;
        this.label3.Location = new Point(0x10, 50);
        this.label3.Name = "label3";
        this.label3.Size = new Size(0x23, 12);
        this.label3.TabIndex = 9;
        this.label3.Text = "描述:";
        this.label1.AutoSize = true;
        this.label1.Location = new Point(0x10, 0x18);
        this.label1.Name = "label1";
        this.label1.Size = new Size(0x23, 12);
        this.label1.TabIndex = 9;
        this.label1.Text = "标题:";
        this.txtclick.Location = new Point(0x39, 0x49);
        this.txtclick.Name = "txtclick";
        this.txtclick.Size = new Size(0x20d, 0x15);
        this.txtclick.TabIndex = 12;
        this.toolTip_0.SetToolTip(this.txtclick, "如果你要自助单品推广,请填写你的单品推广URL");
        this.lblTip.AutoSize = true;
        this.lblTip.ForeColor = Color.Red;
        this.lblTip.Location = new Point(0x10, 0x22d);
        this.lblTip.Name = "lblTip";
        this.lblTip.Size = new Size(0x6b, 12);
        this.lblTip.TabIndex = 10;
        this.lblTip.Text = "欢迎使用都客产品!";
        this.saveFileDialog_0.Filter = "csv文件|*.csv|所有文件|*.*";
        this.openFileDialog_0.Filter = "csv文件|*.csv|所有文件|*.*";
        this.webBrowser1.Location = new Point(0x38c, 12);
        this.webBrowser1.MinimumSize = new Size(20, 20);
        this.webBrowser1.Name = "webBrowser1";
        this.webBrowser1.Size = new Size(40, 0x18);
        this.webBrowser1.TabIndex = 11;
        this.webBrowser1.Visible = false;
        this.txtImageUrl.Location = new Point(0x1a1, 0x2f);
        this.txtImageUrl.Name = "txtImageUrl";
        this.txtImageUrl.Size = new Size(0x197, 0x15);
        this.txtImageUrl.TabIndex = 13;
        this.txtImageUrl.TextChanged += new EventHandler(this.txtImageUrl_TextChanged);
        this.txtImageUrl.Leave += new EventHandler(this.txtImageUrl_Leave);
        this.btnAutoShare.Location = new Point(0x1eb, 13);
        this.btnAutoShare.Name = "btnAutoShare";
        this.btnAutoShare.Size = new Size(0x4b, 0x17);
        this.btnAutoShare.TabIndex = 14;
        this.btnAutoShare.Text = "自动分享";
        this.btnAutoShare.UseVisualStyleBackColor = true;
        this.btnAutoShare.Click += new EventHandler(this.btnAutoShare_Click);
        this.label5.AutoSize = true;
        this.label5.Location = new Point(0x17d, 0x37);
        this.label5.Name = "label5";
        this.label5.Size = new Size(0x23, 12);
        this.label5.TabIndex = 14;
        this.label5.Text = "图片:";
        this.btnClear.Location = new Point(0x2ed, 0x47);
        this.btnClear.Name = "btnClear";
        this.btnClear.Size = new Size(0x4b, 0x17);
        this.btnClear.TabIndex = 15;
        this.btnClear.Text = "清空";
        this.btnClear.UseVisualStyleBackColor = true;
        this.btnClear.Click += new EventHandler(this.btnClear_Click);
        base.AutoScaleDimensions = new SizeF(6f, 12f);
        // base.AutoScaleMode = AutoScaleMode.Font;
        base.ClientSize = new Size(0x3d8, 580);
        base.Controls.Add(this.btnAutoShare);
        base.Controls.Add(this.webBrowser1);
        base.Controls.Add(this.lblTip);
        base.Controls.Add(this.groupBox1);
        base.Controls.Add(this.tbimg);
        base.Controls.Add(this.btnImport);
        base.Controls.Add(this.btnOutput);
        base.Controls.Add(this.button1);
        base.Controls.Add(this.btnBrowser);
        base.Controls.Add(this.lvList);
        base.Controls.Add(this.btnCollect);
        //base.Icon = (Icon) manager.GetObject("$this.Icon");
        base.MaximizeBox = false;
        base.Name = "MainFrm";
        base.StartPosition = FormStartPosition.CenterScreen;
        this.Text = "老牛淘客助手 1.3   →官方 www.mou18.com 客服qq:1902976602";
        base.FormClosing += new FormClosingEventHandler(this.MainFrm_FormClosing);
        this.contextMenuStrip1.ResumeLayout(false);
        ((ISupportInitialize)this.tbimg).EndInit();
        this.groupBox1.ResumeLayout(false);
        this.groupBox1.PerformLayout();
        base.ResumeLayout(false);
        base.PerformLayout();
    }

    private void lvList_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e) {
        if (e.Item.SubItems.Count > 7) {
            this.tbimg.ImageLocation = e.Item.SubItems[7].Text + "_sum.jpg";
            this.txtImageUrl.Text = this.tbimg.ImageLocation;
            this.txtTitle.Text = e.Item.SubItems[1].Text;
            this.txtclick.Text = e.Item.SubItems[5].Text;
            this.txtPrice.Text = e.Item.SubItems[3].Text;
        }
    }

    private void lvList_MouseDoubleClick(object sender, MouseEventArgs e) {
        ListViewItem item = this.lvList.SelectedItems[0];
        if (item != null) {
            if (item.SubItems[5].Text.Trim() != "") {
                Process.Start(item.SubItems[5].Text.Trim());
            }
            else {
                Process.Start("http://item.taobao.com/item.htm?id=" + item.Tag);
            }
        }
    }

    private void MainFrm_FormClosing(object sender, FormClosingEventArgs e) {
        Environment.Exit(0);
    }

    private void method_0(object object_0, object object_1) {
        if (object_0 is LoginFetchFrm) {
            Page page = object_1 as Page;
            string body = page.Body;
            if (!string.IsNullOrEmpty(body)) {
                this.method_1(body);
            }
        }
    }

    private void method_1(string string_2) {
        try {
            if (predicate_0 == null) {
                predicate_0 = new Predicate<tbproduct>(MainFrm.smethod_1);
            }
            foreach (tbproduct tbproduct in JsonHelper.FromJson<List<tbproduct>>(string_2).FindAll(predicate_0)) {
                ListViewItem item = new ListViewItem();
                item.SubItems[0].Text = (this.lvList.Items.Count + 1).ToString();
                item.SubItems.AddRange(new string[] { tbproduct.Title, tbproduct.price, tbproduct.mprice, "", "", "", tbproduct.picurl.Replace("_sum.jpg", "") });
                item.Tag = tbproduct.String_0;
                item.Name = "item" + tbproduct.String_0;
                if (this.lvList.Items.IndexOfKey(item.Name) < 0) {
                    this.lvList.Items.Add(item);
                }
            }
        }
        catch (Exception exception) {
            MessageBox.Show(exception.Message);
        }
    }

    private void method_2() {
        int num2 = 0;
        System.Collections.IEnumerator enumerator = this.lvList.Items.GetEnumerator();
        //using (IEnumerator enumerator = (IEnumerator)this.lvList.Items.GetEnumerator())
        {
            while (enumerator.MoveNext()) {
                ListViewItem current = (ListViewItem)enumerator.Current;
                string strLink = string.Format("http://u.alimama.com/union/spread/common/allCode.htm?specialType=item&auction_id={0}", current.Tag);
                Comm.Refer = strLink;
                if (!(Comm.ContainerCookies != "")) {
                    goto Label_018C;
                }
                string input = Comm.HtmlofAgent(strLink, Encoding.GetEncoding("gb2312"));
                Regex regex = new Regex("clickUrl = '(.*?)'", RegexOptions.IgnoreCase);
                string str3 = regex.Match(input).Groups[1].Value;
                current.SubItems[5].Text = str3;
                this.lblTip.Text = string.Format("正在采集推广链接...{0}/{1}", num2 + 1, this.lvList.Items.Count);
                string str5 = Comm.HtmlofAgent("http://item.taobao.com/item.htm?id=" + current.Tag, Encoding.GetEncoding("gb2312"));
                Regex regex2 = new Regex("\"apiItemInfo\":\"(.*?ifq.htm.*?)\"", RegexOptions.IgnoreCase);
                string str7 = Comm.HtmlofAgent(regex2.Match(str5).Groups[1].Value, Encoding.GetEncoding("gb2312"));
                Match match3 = new Regex(@"quanity: (\d+),", RegexOptions.IgnoreCase).Match(str7);
                current.SubItems[4].Text = match3.Groups[1].Value;
                num2++;
            }
            goto Label_01AD;
        Label_018C:
            MessageBox.Show("请先登录阿里妈妈!");
        }
    Label_01AD:
        this.thread_0 = null;
        this.btnCollect.Enabled = true;
        this.lblTip.Text = "推广链接采集完成!";
    }

    public static string smethod_0(string string_2) {
        StringBuilder builder = new StringBuilder();
        byte[] bytes = Encoding.UTF8.GetBytes(string_2);
        for (int i = 0; i < bytes.Length; i++) {
            builder.Append("%" + Convert.ToString(bytes[i], 0x10));
        }
        return builder.ToString();
    }

    [CompilerGenerated]
    private static bool smethod_1(tbproduct tbproduct_0) {
        return !string.IsNullOrEmpty(tbproduct_0.Title);
    }

    private void txtImageUrl_Leave(object sender, EventArgs e) {
    }

    private void txtImageUrl_TextChanged(object sender, EventArgs e) {
        if (this.txtImageUrl.Text.Trim() != string.Empty) {
            try {
                this.tbimg.ImageLocation = this.txtImageUrl.Text.Trim();
            }
            catch {
            }
        }
    }

    private void 查看宝贝ToolStripMenuItem_Click(object sender, EventArgs e) {
        ListViewItem item = this.lvList.SelectedItems[0];
        if (item != null) {
            Process.Start("http://item.taobao.com/item.htm?id=" + item.Tag);
        }
    }

    private void 清空列表ToolStripMenuItem_Click(object sender, EventArgs e) {
        this.lvList.Items.Clear();
    }

    private void 删除所选ToolStripMenuItem_Click(object sender, EventArgs e) {
        foreach (ListViewItem item in this.lvList.SelectedItems) {
            item.Remove();
        }
    }
}

